package com.example.springbootexperiment02.custom;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;


@NoArgsConstructor
@AllArgsConstructor
public class MyRunnerImpl implements CommandLineRunner {

    private Environment environment;



    @Override
    public void run(String... args) throws Exception {
        System.out.println("Spring Boot 自动装配MyRunnerImpl。");

        System.out.format("生成一个随机字符串：%s\n",environment.getProperty("random."));
    }
}